package com.ymdx.service.impl;

import com.ymdx.dao.impl.BaseDaoImpl;
import com.ymdx.entity.Course;
import com.ymdx.service.CourseService;
import com.ymdx.util.Page;
import com.ymdx.util.tool.HqlUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by yangliwei on 2017/8/22.
 */
@Service("courseService")
@Transactional
public class CourseServiceImpl extends BaseServiceImpl<Course,Long> implements CourseService{

    @Resource
    BaseDaoImpl courseDao;


    @Override
    public Page<Course> page(Page<Course> page, Map<String, Object> args) {
        StringBuilder hql = new StringBuilder("from Course where valid = true ");
        List params = new ArrayList();

        HqlUtil.andHql(hql,args,params);
        return courseDao.page(hql.toString(), page, params.toArray());
    }


}
